package com.ccc.controller;


import com.ccc.Beans.user;
import com.ccc.services.services;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class HelloController {
    @Autowired
    private services Sev;
    @RequestMapping(path="/hello")
    public String sayhello()
    {
        System.out.println("hello springMVC");
        return "success";
    }
    @RequestMapping(path = "/saveUser")
    public String saveUser(@Param("username")String username,@Param("password")String password){
        user user1 = new user(password,username);
        System.out.println(user1.getUsername()+user1.getPassword());
        int i = 0;
        i = Sev.saveUser(user1);
        if(i==1)
        return "success";
        else
            return "fail";
    }
}
